<template>
	<view class="more" v-if="showPage">
		<view class="container bg coF" style="height: 350rpx;" v-if="!!userInfo">
			<view class="w100 pt50 pl20 flex-spc-x">
				<!-- <view class="w20"><u-avatar size="large" src="../../static/logo.png"></u-avatar></view> -->
				<view class="w20">
					<u-avatar v-if="!!userInfo.imgUrl" size="large" :src="userInfo.imgUrl"></u-avatar>
					<u-avatar v-else size="large" src="../../static/logo.png"></u-avatar>
					</view>
				<view class="w80 ">
					<text class="fs34">{{ userInfo.phone }}</text>
					<text class="fs28 pl10">{{ userInfo.nickName }}</text>
					<!-- <text class="fs34">{{ userInfo.nickName }}</text> -->
					<view class="fs24 pt10 pb10">
						<text v-if="userInfo.vip==0">普通用户</text>
						<text v-if="userInfo.vip==1">平台会员</text>
					</view>
				</view>
			</view>

			<view class="w100 flex-spc-x pl20 pt20 pb10">
				<view class="w50">
					<text>矿币：</text>
					<text>{{ userInfo.money }}</text>
				</view>
				<view class="w50">
					<text>冻结矿币：</text>
					<text>{{ userInfo.disabledMoney }}</text>
				</view>
			</view>

			<view class="w100 flex-spc-x pl20  pb10">
				<view class="w50">
					<text>幸运币：</text>
					<text>{{ userInfo.earnBean }}</text>
				</view>
				<view class="w50">
					<text>直推人数：：</text>
					<text>{{ userInfo.numberPerson }}</text>
				</view>
			</view>
				<view class="w100 flex-spc-x pl20  pb10">
					<view class="w50">
						<text>算力：</text>
						<text>{{ userInfo.power }}</text>
					</view>
					<view class="w50">
						<!-- <text>冻结幸运币：</text>
						<text>{{ userInfo.disabledLuckyCoin }}</text> -->
					</view>
				</view>
			
		</view>

		<view class="container bgF mt20">
			<u-grid :col="3" :border="false">
				<u-grid-item @click="toMyCommunity">
					<u-image width="80rpx" height="80rpx" src="../../static/more/wodeshequ.png"></u-image>
					<view class="grid-text mt10">我的社区</view>
				</u-grid-item>
				<!-- 		<u-grid-item @click="toShare">
					<u-image width="80rpx" height="80rpx" src="../../static/more/tuiguang.png"></u-image>
					<view class="grid-text mt10">推广分享</view>
				</u-grid-item> -->
				<u-grid-item @click="toAppealRecord">
					<u-image width="80rpx" height="80rpx" src="../../static/more/shensu.png"></u-image>
					<view class="grid-text mt10">申诉记录</view>
				</u-grid-item>
				<u-grid-item @click="toMoneyDetail">
					<u-image width="80rpx" height="80rpx" src="../../static/more/zijin.png"></u-image>
					<view class="grid-text mt10">资金明细</view>
				</u-grid-item>
			</u-grid>

			<u-grid :col="3" :border="false">
				<u-grid-item @click="toSystemDetail">
					<u-image width="80rpx" height="80rpx" src="../../static/more/xitong.png"></u-image>
					<view class="grid-text mt10">系统公告</view>
				</u-grid-item>

				<u-grid-item @click="toSafe">
					<u-image width="80rpx" height="80rpx" src="../../static/more/safe.png"></u-image>
					<view class="grid-text mt10">安全中心</view>
				</u-grid-item>
			</u-grid>
		</view>
	</view>
</template>

<script>
export default {
	data() {
		return {
			userInfo: null,
			showPage: false, //没有登录不显示内容
			src: 'http://pic2.sc.chinaz.com/Files/pic/pic9/202002/hpic2119_s.jpg'
		};
	},
	// 更多页面里面已经拦截了是否登录   不需要贼每个单独的页面里面拦截登录了
	onLoad(options) {
		if (this.judgeLoading(options)) {
			this.showPage = true;
		}
	},
	onShow() {
		if (this.showPage) {
			this.getUserInfo();
		}
	},
	methods: {
		getUserInfo() {
			// GET/mobileUser/phone/{userId}获取用户详细信息
			var postObj = {
				url: `/mobileUser/phone/getInfo`,
				data: {
					userId: uni.getStorageSync('y-userId'),
					token: uni.getStorageSync('y-token')
				}
			};
			// /${uni.getStorageSync('y-userId')}/${uni.getStorageSync('y-token')
			// userId:uni.getStorageSync('y-userId'),token:uni.getStorageSync('y-token')
			this.getRequest(postObj)
				.then(res => {
					// console.log('res获取用户详细信息 ', res);
					if (res.data.code == 200) {
						this.userInfo = res.data.data;
					}
				})
				.catch(err => {
					// console.log('err获取用户详细信息 ', err);
				});
		},
		// 去我的社区
		toMyCommunity() {
			uni.navigateTo({
				url: '/pages/more/myCommunity'
			});
		},
		// 去分享
		toShare() {
			uni.navigateTo({
				url: '/pages/more/share'
			});
		},
		// 资金明细
		toMoneyDetail() {
			uni.navigateTo({
				url: '/pages/more/moneyDetail'
			});
		},
		// 系统公告toSystemDetail
		toSystemDetail() {
			uni.navigateTo({
				url: '/pages/more/notice'
			});
		},
		//申诉记录
		toAppealRecord() {
			uni.navigateTo({
				url: '/pages/more/appealRecord'
			});
		},
		//安全中心
		toSafe() {
			uni.navigateTo({
				url: '/pages/more/safe'
			});
		}
	}
};
</script>

<style lang="scss" scoped>
.bg {
	background: url(../../static/more/bg.png) no-repeat 0 0;
	background-size: 100% 100%;
	position: relative;
	padding-bottom: 44px;
}
</style>
